<?php
	/* Página inicial dos fóruns */

	session_start();

	include("/var/www/html/vivencias/conexaoBD.php");
	include("/var/www/html/vivencias/verificaRecursosAtivados.php");
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Experi&ecirc;ncias do Processo de Adoecimento</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="vivencias.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body onLoad="MM_preloadImages('imagens/stt_correio2.jpg','imagens/stt_avisos2.jpg','imagens/stt_faq2.jpg','imagens/stt_chats2.jpg','imagens/stt_foruns2.jpg')">
<div align="center">
  <table width="1000" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="10%" align="left" valign="top"><img src="imagens/logo.jpg" width="66" height="53"></td>
                  <td width="90%"><img src="imagens/tit1.jpg" width="612" height="28"></td>
                </tr>
              </table></td>
          </tr>
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr align="left" valign="middle">
                  <td colspan="3" class="nomecurso"><?php echo $_SESSION['nomeCurso']; ?></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td><a href="index.php"><img src="imagens/sair.gif" width="33" height="19" border="0"></a></td>
                </tr>
                <tr align="left" valign="middle">
                  <td width="25%">&nbsp;</td>
                  <td width="22%">&nbsp;</td>
                  <td width="52%">&nbsp;</td>
                  <td width="0%">&nbsp;</td>
                  <td width="0%">&nbsp;</td>
                  <td width="1%">&nbsp;</td>
                </tr>
              </table></td>
          </tr>
          <tr>
            <td><table width="96%" border="0" cellspacing="0" cellpadding="0">
                <tr align="left" valign="top">
		<!-- Somente o professor do curso pode visualizar o gerenciamento.-->
		<?php if(($_SESSION['idTipoUsuario']=="0")||($_SESSION['idTipoUsuario']=="1")||($_SESSION['idTipoUsuario']=="5")){?>
                  <td width="3%" background="imagens/bar_fnd_8.jpg" bgcolor="EBF4F9"><a href="relatorios.htm"><img src="imagens/mn_8.jpg" width="23" height="161" border="0"></a></td>
		<?php } ?>
                  <td width="3%" background="imagens/bar_fnd_7.jpg"><a href="info.php"><img src="imagens/mn_7.jpg" width="23" height="137" border="0"></a></td>
                  <td width="3%" background="imagens/bar_fnd_6.jpg"><a href="esppess.php"><img src="imagens/mn_6.jpg" width="23" height="156" border="0"></a></td>
                  <td width="3%" background="imagens/bar_fnd_5.jpg"><a href="comunicacao.php"><img src="imagens/mn_5.jpg" width="23" height="146" border="0"></a></td>
                  <td width="66%" align="center" bgcolor="f6fafe">
                    <table width="816" border="0" cellpadding="0" cellspacing="0">
                      <tr align="left" valign="top">
		<?php if($objetoN->forum){ ?>
                        <td width="10" height="21"><img src="imagens/pix_cor5b.gif" width="10" height="5"></td>
                        <td width="54"><a href="foruns.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('foruns','','imagens/stt_foruns2.jpg',1)"><img src="imagens/stt_foruns2.jpg" name="foruns" width="54" height="21" border="0"></a></td>
		<?php } ?>
		<?php if($objetoN->correio){ ?>
                        <td width="10"><img src="imagens/pix_cor5b.gif" width="10" height="5"></td>
                        <td width="61"><a href="correio.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('correio','','imagens/stt_correio2.jpg',1)"><img src="imagens/stt_correio1.jpg" name="correio" width="61" height="21" border="0"></a></td>
		<?php } ?>
		<?php if($objetoN->avisos){ ?>
                        <td width="10"><img src="imagens/pix_cor5b.gif" width="10" height="5"></td>
                        <td width="52"><a href="avisos.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('avisos','','imagens/stt_avisos2.jpg',1)"><img src="imagens/stt_avisos1.jpg" name="avisos" width="52" height="21" border="0"></a></td>
		<?php } ?>
		<?php if($objetoN->perguntasRespostas){ ?>
			<?php if($_SESSION['idTipoUsuario'] != "3"){ ?>
                        <td width="10"><img src="imagens/pix_cor5b.gif" width="10" height="5"></td>
                        <td width="36"><a href="faq.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('faq','','imagens/stt_faq2.jpg',1)"><img src="imagens/stt_faq1.jpg" name="faq" width="36" height="21" border="0"></a></td>
			<?php } ?>		
		<?php } ?>
		<?php if($objetoN->chat){ ?>
                        <td width="10"><img src="imagens/pix_cor5b.gif" width="10" height="5"></td>
                        <td width="40"><a href="chat.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('chat','','imagens/stt_chats2.jpg',1)"><img src="imagens/stt_chats1.jpg" name="chat" width="40" height="21" border="0"></a></td>
		<?php } ?>
                        <td width="10">&nbsp;</td>
                        <td width="40">&nbsp;</td>
                        <td width="223">&nbsp;</td>
                      </tr>
                      <tr align="center" valign="middle">
                        <td colspan="13"><img src="imagens/pix_cor5c.gif" width="810" height="2"></td>
                      </tr>
                      <tr align="left" valign="top">
                        <td colspan="13"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                              <td height="20"><img src="imagens/pix_cor5b.gif" width="10" height="5"></td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                            </tr>
                          </table></td>
                      </tr>
                    </table>
                    <table width="100%" border="0" cellspacing="1" cellpadding="5">
                      <tr>
                        <td align="center" valign="middle"><table width="95%" border="0" cellpadding="5" cellspacing="1">
			    <tr>
                       		<td align="right" valign="middle" class="miudo">
				   <a href="javascript:void();" onclick="javascript:window.open('duvidaF1.htm','Janela','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=600,height=400');"><img src="imagens/duvida8.gif" width="24" height="24" border="0"></a>
				</td>
                      	    </tr>
                            <tr>
                              <td align="center" valign="middle" bgcolor="d5e1ee">
                                <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#FFFFFF">
                                  <tr align="center" bgcolor="#38708F" class="texttab">
                                    <td align="left" valign="top" bgcolor="83b3e3">
                                      <div align="left" class="ativo">F&oacute;runs
                                        dispon&iacute;veis</div></td>
                                  </tr>
                                  <tr align="center" bgcolor="#38708F" class="texttab">
                                    <td align="center" valign="middle" bgcolor="d5e1ee" class="texto2">
				       <table width="95%" border="0" cellpadding="5" cellspacing="1" bgcolor="#FFFFFF">

			<?php

				if( ($_SESSION['idTipoUsuario']==2) || ($_SESSION['idTipoUsuario']==5) ){//aluno
					$query = "SELECT * FROM foruns WHERE (idTipoForum=0 OR idTipoForum=3 OR idTipoForum=4) AND idCurso='".$_SESSION['idCurso']."' AND ativado=1 ORDER BY ordem";
					$resultado = mysql_query($query,$conexao);
					while($objeto = mysql_fetch_object($resultado)){
						echo '<tr class="texttab">';
						if($objeto->idTipoForum == 0){//principal
                                         		echo '<td bgcolor="6f0a36" class="texto2">&nbsp;</td>';
						}else if($objeto->idTipoForum == 3){//prof,aluno,paciente
							echo '<td bgcolor="e14e1a" class="texto2">&nbsp;</td>';
						}else if($objeto->idTipoForum == 4){//aluno,aluno
							echo '<td bgcolor="d36e3c" class="texto2">&nbsp;</td>';
						}
                                        	echo '<td bgcolor="d5e1ee"><a href="forumTopicos.php?idForum='.$objeto->idForum.'&idTipoForum='.$objeto->idTipoForum.'" class="texto2"><strong>';
						echo $objeto->titulo;
						echo '</strong></a></td></tr>';

					}
				}else if( ($_SESSION['idTipoUsuario']==3) || ($_SESSION['idTipoUsuario']==5) ){//paciente
					$query = "SELECT * FROM foruns WHERE (idTipoForum=2 OR idTipoForum=3 OR idTipoForum=5) AND idCurso='".$_SESSION['idCurso']."' AND ativado=1 ORDER BY ordem";
					$resultado = mysql_query($query,$conexao);
					while($objeto = mysql_fetch_object($resultado)){
						echo '<tr class="texttab">';
						if($objeto->idTipoForum == 2){//prof,paciente
                                         		echo '<td bgcolor="d41a27" class="texto2">&nbsp;</td>';
						}else if($objeto->idTipoForum == 3){//prof,aluno,paciente
                                         		echo '<td bgcolor="e14e1a" class="texto2">&nbsp;</td>';
						}else if($objeto->idTipoForum == 5){//paciente,paciente
                                         		echo '<td bgcolor="eab22a" class="texto2">&nbsp;</td>';
						}
                                        	echo '<td bgcolor="d5e1ee"><a href="forumTopicos.php?idForum='.$objeto->idForum.'&idTipoForum='.$objeto->idTipoForum.'" class="texto2"><strong>';
						echo $objeto->titulo;
						echo '</strong></a></td></tr>';
					}

				}else if(($_SESSION['idTipoUsuario']=="0") || ($_SESSION['idTipoUsuario']=="1") || ($_SESSION['idTipoUsuario']==5) ){//professor ou tutor
					$query = "SELECT * FROM foruns WHERE (idTipoForum=0 OR idTipoForum=1 OR idTipoForum=2 OR idTipoForum=3) AND idCurso='".$_SESSION['idCurso']."' AND ativado=1 ORDER BY ordem";
					$resultado = mysql_query($query,$conexao);
					while($objeto = mysql_fetch_object($resultado)){
						echo '<tr class="texttab">';
                                         	if($objeto->idTipoForum == 0){//principal
                                         		echo '<td bgcolor="6f0a36" class="texto2">&nbsp;</td>';
						}else if($objeto->idTipoForum == 1){//prof,prof
                                         		echo '<td bgcolor="9d1733" class="texto2">&nbsp;</td>';
						}else if($objeto->idTipoForum == 2){//prof,paciente
                                         		echo '<td bgcolor="d41a27" class="texto2">&nbsp;</td>';
						}else if($objeto->idTipoForum == 3){//prof,aluno,paciente
                                         		echo '<td bgcolor="e14e1a" class="texto2">&nbsp;</td>';
						}
                                        	echo '<td bgcolor="d5e1ee"><a href="forumTopicos.php?idForum='.$objeto->idForum.'&idTipoForum='.$objeto->idTipoForum.'" class="texto2"><strong>';
						echo $objeto->titulo;
						echo '</strong></a></td></tr>';
					}

				}

			?>


                                 
                                        </tr>
                                      </table></td>
                                  </tr>
                                </table></td>
                            </tr>
                            <tr>
                              <td>&nbsp;</td>
                            </tr>
                          </table></td>
                      </tr>
                    </table>
                    <p align="center"><br>
                    </p>
                    <p>&nbsp; </p></td>
                  <td width="6%" align="right" background="imagens/bar_fnd_4.jpg"><a href="banco.php"><img src="imagens/mn_4.jpg" width="23" height="219" border="0"></a>
                  </td>
                  <td width="5%" align="right" background="imagens/bar_fnd_3.jpg"><a href="ferramentasTrabalho.php"><img src="imagens/mn_3.jpg" width="23" height="249" border="0"></a>
                  </td>
                  <td width="3%" align="right" background="imagens/bar_fnd_2.jpg"><a href="conteudo.php"><img src="imagens/mn_2.jpg" width="23" height="113" border="0"></a></td>
                  <td width="8%" align="right" background="imagens/bar_fnd_1.jpg" bgcolor="F1FEF9">
                    <p><a href="principal.php"><img src="imagens/mn_1.jpg" width="23" height="103" border="0"></a></p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p>
                    <p>&nbsp;</p></td>
                </tr>
              </table></td>
          </tr>
        </table></td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
</div>
</body>
</html>
